package com.dit.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dit.dao.EmployeeMapper;
import com.dit.entity.Employee;
import com.dit.entity.Sme;
import com.dit.service.EmployeeService;
import com.dit.util.GuidGenerator;

@Service("employeeService")

public class EmployeeServiceImpl extends AbstractService implements EmployeeService{
	
	@Autowired
	private EmployeeMapper employeeMapper;

	@Override
	public int addEmployee(Employee employee) {
		return employeeMapper.insertSelective(employee);
		
	}

	@Override
	public List<Employee> getEmployeeList() {
		return employeeMapper.selectAll();
		
	}
	
	
	@Override
	public int save(Employee entity, String userId) {
		
		entity.setId(GuidGenerator.employeeKey());
		entity.setUserLoginId("1");
		setInsertSettings(entity, "1");

		return employeeMapper.insertSelective(entity);
	}
	
	@Override
	public Employee getEmployeeDetails(String id){
		return employeeMapper.selectByPrimaryKey(id);
	}
	
	

}
